require('../db');
let cinemasServise = require("../service/cinemasService");

//查询
async function testFind(obj) {
    let data = await cinemasServise.findAll(obj);//返回的是数组
    console.log(data[0]);
    console.log(data[0].screens);
}
// testFind({ "name": "太平洋dsadsa" });
//根据id
async function testFindByid(id) {
    let data = await cinemasServise.findById(id)
    console.log(data);
    console.log(data.screens[0]);
}
// testFindByid("607f904d910c3319232d6b09");
//增加
async function testInsert(obj) {
    console.log(await cinemasServise.insert(obj));
}
let cinemas = {
    "name": "卖黄瓜和",
    "addr": "麻烦给回复的话",
    "tel": 1532123156,
    "url": "www.dsaddds.com",
    "screens": [
        {
            "name": "1号厅",
            "seat": "[[1,1,1,1]]"
        }
    ]
}
testInsert(cinemas);
//修改
async function testUpdata(id, obj) {
    console.log(await cinemasServise.update(id, obj));
}
let uobj = {
    "name": "1111111",
    "addr": "春熙路大连连看",
    "tel": 1532123156,
    "url": "www.dsaddds.com",
    "screens": [
        {
            "name": "1号厅",
            "seat": [
                [
                    1,
                    0,
                    1
                ],
                [
                    1,
                    1,
                    1
                ]
            ]
        }
    ]
}
// testUpdata("607f96376ec71140e445eedb", uobj);
//删除
async function testDelete(id) {
    console.log(await cinemasServise.delete(id));
}
// testDelete("607f904d910c3319232d6b09");